<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/spring.tld"%>
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld"%>
<c:set var="BasePath" value="${pageContext.request.contextPath}"></c:set>
<c:set var="Plugins" value="${pageContext.request.contextPath}/res/plugins"></c:set>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改供应商</title>
<link href="${Plugins}/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${Plugins}/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
<script src="${Plugins}/jquery/jquery-1.4.4.min.js"	type="text/javascript"></script>
<script src="${Plugins}/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="${Plugins}/jquery-validation/jquery.validate.min.js" type="text/javascript"></script>
<script src="${Plugins}/jquery-validation/jquery.metadata.js" type="text/javascript"></script>
<script src="${Plugins}/jquery-validation/messages_cn.js" type="text/javascript"></script>
<script src="${BasePath}/res/js/common/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript" src="${BasePath}/res/js/ligerCommon.js"></script>
<script src="${BasePath}/res/js/common/jquery.validate.method.js" type="text/javascript"></script>
<script src="${Plugins}/datepicker/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript" src="${BasePath}/res/js/json2.js"></script>
<style type="text/css">
    body{ font-size:12px;}
    .l-table-edit {}
    .l-table-edit-td{ padding:4px;}
    .l-button-submit,.l-button-test{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
    .l-verify-tip{ left:230px; top:120px;}
    .p-tab .s-lab{font-size:12px;font-family:"微软雅黑",​"宋体",​Arial,​sans-serif;}
	input.l-textarea{width:170px;height:20px;font-size:12px;}
	 .navbar {
		height: 20px;
		border-bottom: #E6E6E6 solid 1px;
		line-height: 20px;
	}
</style>
</head>
<body style="padding:10px">
<div class="navbar">
		<span>您当前的位置：</span>
		基础数据管理&gt;供应商管理&gt;修改供应商
</div>
<form name="form1" method="post" action="u_supplierInfo.do" id="form1">
<br>
<input type="hidden" name="registerDate" id="registerDate"  value="${SupplierInfo.registerDate}">
<input type="hidden" name="code" id="code" value="${SupplierInfo.code}">
<%-- <input type="hidden" name="id" id="id"  value="${SupplierInfo.id}"> --%>
<table cellpadding="0" cellspacing="0" class="l-table-edit p-tab" >
	
	 <tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>供应商帐号：</td>
        <td align="left" class="l-table-edit-td s-lab"><input name="account" id="account"  type="text" class="l-textarea"  maxlength="20"  disabled="disabled" id="account" value="${SupplierInfo.account}"  validate="{required:true,minlength:1,maxlength:20}" /></td>
        <td align="left"><span style="color:red" id="error"></span></td>
    </tr>
	
    <tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>供应商名称：</td>
        <td align="left" class="l-table-edit-td s-lab"><input name="supName"  type="text" id="supName" value="${SupplierInfo.supName}" maxlength="20" class="l-textarea"  validate="{required:true,minlength:1,maxlength:20}" /></td>
        <td align="left"></td>
    </tr>
     <tr>
        <td align="right" class="l-table-edit-td s-lab">供应商简称：</td>
        <td align="left" class="l-table-edit-td s-lab"><input name="supShortName" type="text" id="supShortName"  maxlength="20"  value="${SupplierInfo.supShortName}" class="l-textarea"  validate="{minlength:1,maxlength:20}" /></td>
        <td align="left"></td>
    </tr>
     <tr style="display: none">
        <td align="right" class="l-table-edit-td s-lab">供应商编号：</td>
        <td align="left" class="l-table-edit-td s-lab"><input name="supCode" type="text" id="supCode" value="${SupplierInfo.supCode}" maxlength="20" class="l-textarea" validate="{minlength:1,maxlength:20}" /></td>
        <td align="left"></td>
    </tr>
    <tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>联系人：</td>
        <td align="left" class="l-table-edit-td s-lab"> 
        <input id="linkman" type="text" name="linkman"  class="l-textarea" value="${SupplierInfo.linkman}"   maxlength="20"  validate="{required:true,minlength:1,maxlength:20}">
        </td><td align="left"></td>
    </tr>
    <tr>
        <td align="right" class="l-table-edit-td s-lab">固定电话：</td>
        <td align="left" class="l-table-edit-td s-lab"> 
        <input id="telephoneNum" type="text" name="telephoneNum"  class="l-textarea" value="${SupplierInfo.telephoneNum}"   validate="{phone:true}">
        </td><td align="left"></td>
    </tr>
     <tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>手机号码：</td>
        <td align="left" class="l-table-edit-td s-lab"> 
        <input id="mobileNhonenum" type="text" name="mobileNhonenum"  class="l-textarea" value="${SupplierInfo.mobileNhonenum}"   validate="{required:true,mobile:true}">
        </td><td align="left"></td>
    </tr>
    <tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>经营类别：</td>
        <td align="left" class="l-table-edit-td s-lab"> 
        <input id="operateTpye" type="text" name="operateTpye"  class="l-textarea" maxlength="30"  value="${SupplierInfo.operateTpye}" validate="{required:true}">
        </td><td align="left"></td>
    </tr>
     <tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>电子邮箱：</td>
        <td align="left" class="l-table-edit-td s-lab"> 
        <input id="email" type="text" name="email"  value="${SupplierInfo.email}" class="l-textarea"  maxlength="50"   validate="{required:true,email:true,rangelength:[1,50]}">
        </td><td align="left"></td>
    </tr>
     <tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>合同开始日期：</td>
        <td align="left" class="l-table-edit-td s-lab"> 
        <input type="text" name="contractDayStrat" id="contractDayStrat"
    	value="${SupplierInfo.contractDayStrat}"   validate="{required:true}"   class="l-textarea"  size="18" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,autoPickDate:true})"/>
        </td><td align="left"></td>
    </tr>
       <tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>合同结束日期：</td>
        <td align="left" class="l-table-edit-td s-lab"> 
        <input type="text" name="contractDayEnd" id="contractDayEnd"
    	value="${SupplierInfo.contractDayEnd}"   validate="{required:true}"   class="l-textarea"  size="18" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,autoPickDate:true})"/>
        </td><td align="left"></td>
    </tr>
       <tr>
        <td align="right" class="l-table-edit-td s-lab">联系地址：</td>
        <td align="left" class="l-table-edit-td s-lab"> 
        <input id="address" type="text" name="address"  value="${SupplierInfo.address}"  maxlength="100"  class="l-textarea" validate="{minlength:1,maxlength:100}">
        </td><td align="left"></td>
    </tr>
      <tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>
                     结算类型：</td>
        <td align="left" class="l-table-edit-td s-lab"> 
         
        </td><td align="left"></td>
    </tr>
<!-- 结算类型判断开始 -->
     <c:choose>
      <c:when test="${accountSize == 1}">
         <c:forEach items="${supplierAccountsList}" var="item">
              <c:if test="${item.accountsType=='2'}">
				   <tr>
				        <td align="right" class="l-table-edit-td s-lab">
				        <input id="accountsType_2" type="checkbox" name="accountsType_2" checked=true value="2"></td>
				        <td align="left" class="l-table-edit-td s-lab"> 
				                                   代销结算
				         </td><td align="left"></td>
				       </tr>
				           <tr>
					        <td align="right" class="l-table-edit-td s-lab"></td>
					        <td align="left" class="l-table-edit-td s-lab"> 
							    <table cellpadding="0" cellspacing="0"  id="agency_tb"  class="l-table-edit p-tab" >
							     <c:if test="${item.accountsWay=='2'}">
							    <tr>
							        <td align="right" class="l-table-edit-td s-lab" >结算方式：</td>
							         <td align="left" class="l-table-edit-td s-lab">
							         <input name="accountsWay" type="radio"  id="accountsWay_1"  value="1"/>扣点
							         <input name="accountsWay" type="radio"  checked="checked"  id="accountsWay_2" value="2"/>底价
							         </td>
							        <td align="left"></td>
							    </tr>
							     <tr id="pointsScaleId">
							        <td align="right" class="l-table-edit-td s-lab">扣点比例：</td>
							        <td align="left" class="l-table-edit-td "><input name="pointsScale" class="l-textarea"   maxlength="3"  type="text"  id="pointsScale"  />%</td>
							        <td align="left"></td>
							    </tr>
				       
				       </c:if>
				       
					   <c:if test="${item.accountsWay=='1'}">
						<tr>
				        <input name="accountsType" id="accountsType"  type="hidden" value="2">
				        <td align="right" class="l-table-edit-td s-lab" >结算方式：</td>
				         <td align="left" class="l-table-edit-td s-lab">
				         <input name="accountsWay" type="radio" checked="checked"  id="accountsWay_1"  value="1"/>扣点
				         <input name="accountsWay" type="radio" id="accountsWay_2" value="2"/>底价
				         </td>
				        <td align="left"></td>
				     </tr>
				     <tr id="pointsScaleId">
				        <td align="right" class="l-table-edit-td s-lab">扣点比例：</td>
				        <td align="left" class="l-table-edit-td "><input name="pointsScale"  maxlength="3"  class="l-textarea"  value="${item.pointsScale}"  type="text"  id="pointsScale" />%</td>
				        <td align="left"></td>
				    </tr>
				   </c:if>
							  
					             <tr>
							         <td align="right" class="l-table-edit-td s-lab">结算周期（每月）：</td>
							         <td align="left" class="l-table-edit-td s-lab"> 
							         <select id="accountsTime_2" name="accountsTime" width="30%" class="l-textarea">
							         <option value="">请选择</option>
							         <option value="1" <c:if test="${item.accountsTime=='1'}">selected</c:if>>1</option>
							         <option value="2" <c:if test="${item.accountsTime=='2'}">selected</c:if>>2</option>
							         <option value="3" <c:if test="${item.accountsTime=='3'}">selected</c:if>>3</option>
							         <option value="4" <c:if test="${item.accountsTime=='4'}">selected</c:if>>4</option>
							         <option value="5" <c:if test="${item.accountsTime=='5'}">selected</c:if>>5</option>
							         <option value="6" <c:if test="${item.accountsTime=='6'}">selected</c:if>>6</option>
							         <option value="7" <c:if test="${item.accountsTime=='7'}">selected</c:if>>7</option>
							         <option value="8" <c:if test="${item.accountsTime=='8'}">selected</c:if>>8</option>
							         <option value="9" <c:if test="${item.accountsTime=='9'}">selected</c:if>>9</option>
							         <option value="10" <c:if test="${item.accountsTime=='10'}">selected</c:if>>10</option>
							         <option value="11" <c:if test="${item.accountsTime=='11'}">selected</c:if>>11</option>
							         <option value="12" <c:if test="${item.accountsTime=='12'}">selected</c:if>>12</option>
							         <option value="13" <c:if test="${item.accountsTime=='13'}">selected</c:if>>13</option>
							         <option value="14" <c:if test="${item.accountsTime=='14'}">selected</c:if>>14</option>
							         <option value="15" <c:if test="${item.accountsTime=='15'}">selected</c:if>>15</option>
							         <option value="16" <c:if test="${item.accountsTime=='16'}">selected</c:if>>16</option>
							         <option value="17" <c:if test="${item.accountsTime=='17'}">selected</c:if>>17</option>
							         <option value="18" <c:if test="${item.accountsTime=='18'}">selected</c:if>>18</option>
							         <option value="19" <c:if test="${item.accountsTime=='19'}">selected</c:if>>19</option>
							         <option value="20" <c:if test="${item.accountsTime=='20'}">selected</c:if>>20</option>
							         <option value="21" <c:if test="${item.accountsTime=='21'}">selected</c:if>>21</option>
							         <option value="22" <c:if test="${item.accountsTime=='22'}">selected</c:if>>22</option>
							         <option value="23" <c:if test="${item.accountsTime=='23'}">selected</c:if>>23</option>
							         <option value="24" <c:if test="${item.accountsTime=='24'}">selected</c:if>>24</option>
							         <option value="25" <c:if test="${item.accountsTime=='25'}">selected</c:if>>25</option>
							         <option value="26" <c:if test="${item.accountsTime=='26'}">selected</c:if>>26</option>
							         <option value="27" <c:if test="${item.accountsTime=='27'}">selected</c:if>>27</option>
							         <option value="28" <c:if test="${item.accountsTime=='28'}">selected</c:if>>28</option>
							         <option value="29" <c:if test="${item.accountsTime=='29'}">selected</c:if>>29</option>
							         <option value="30" <c:if test="${item.accountsTime=='30'}">selected</c:if>>30</option>
							         <option value="31" <c:if test="${item.accountsTime=='31'}">selected</c:if>>31</option>
							        </select>
							       日
							       </td><td align="left"></td>
							    </tr>
							  	</table>     
					        	</td>
					        	<td align="left"></td>
			           </tr>
				            
				      <tr>
				         <td align="right" class="l-table-edit-td s-lab"><input id="accountsType_1" type="checkbox" name="accountsType" value="1"></td>
				          <td align="left" class="l-table-edit-td s-lab">  购销结算</td>
				          <td align="left"></td>
				      </tr>
				  
				     <tr>
				        <td align="right" class="l-table-edit-td s-lab"></td>
				        <td align="left" class="l-table-edit-td s-lab"> 
				     <table  id="sellByGou_tb"  cellpadding="0" cellspacing="0" class="l-table-edit p-tab"  style="display: none;">
				       <tr>
				        <td align="right" class="l-table-edit-td s-lab">结算周期（每月）：</td>
				        <td align="left" class="l-table-edit-td s-lab"> 
				         <select id="accountsTime_1" name="accountsTime" width="30%"  class="l-textarea" >
				         <option value="">请选择</option>
				         <option value="1">1</option>
				         <option value="2" >2</option>
				         <option value="3" >3</option>
				         <option value="4">4</option>
				         <option value="5">5</option>
				         <option value="6">6</option>
				         <option value="7">7</option>
				         <option value="8">8</option>
				         <option value="9">9</option>
				         <option value="10">10</option>
				         <option value="11">11</option>
				         <option value="12">12</option>
				         <option value="13">13</option>
				         <option value="14">14</option>
				         <option value="15">15</option>
				         <option value="16">16</option>
				         <option value="17">17</option>
				         <option value="18">18</option>
				         <option value="19">19</option>
				         <option value="20">20</option>
				         <option value="21">21</option>
				         <option value="22">22</option>
				         <option value="23">23</option>
				         <option value="24">24</option>
				         <option value="25">25</option>
				         <option value="26">26</option>
				         <option value="27">27</option>
				         <option value="28">28</option>
				         <option value="29">29</option>
				         <option value="30">30</option>
				         <option value="31">31</option>
				        </select>
				              日
				       </td>
				       <td align="left"></td>
				    </tr>
				   </table>       
				    </td>
				    <td align="left"></td>
				    </tr>
              </c:if>
			    
               <c:if test="${item.accountsType=='1'}">
                 <tr>
				        <td align="right" class="l-table-edit-td s-lab">
				        <input id="accountsType_2" type="checkbox" name="accountsType_2" value="2"></td>
				        <td align="left" class="l-table-edit-td s-lab"> 
				                                   代销结算
				         </td><td align="left"></td>
				       </tr>
					       <tr>
					        <td align="right" class="l-table-edit-td s-lab"></td>
					        <td align="left" class="l-table-edit-td s-lab"> 
							    <table cellpadding="0" cellspacing="0"  style="display: none;"  id="agency_tb"  class="l-table-edit p-tab" >
							    <tr>
							        <input name="accountsType" id="accountsType"  type="hidden" value="2">
							        <td align="right" class="l-table-edit-td s-lab" >结算方式：</td>
							         <td align="left" class="l-table-edit-td s-lab">
							         <input name="accountsWay" type="radio" checked="checked"  id="accountsWay_1"  value="1"/>扣点
							         <input name="accountsWay" type="radio" id="accountsWay_2" value="2"/>底价
							         </td>
							        <td align="left"></td>
							    </tr>
							     <tr id="pointsScaleId">
							        <td align="right" class="l-table-edit-td s-lab">扣点比例：</td>
							        <td align="left" class="l-table-edit-td "><input name="pointsScale" class="l-textarea"  maxlength="3"   value=""  type="text"  id="pointsScale" />%</td>
							        <td align="left"></td>
							    </tr>
							  
							     <tr>
							        <td align="right" class="l-table-edit-td s-lab">结算周期（每月）：</td>
							        <td align="left" class="l-table-edit-td s-lab"> 
							         <select id="accountsTime_2" name="accountsTime" width="30%" class="l-textarea" >
							         <option value="">请选择</option>
							        <option value="1">1</option>
							         <option value="2" >2</option>
							         <option value="3" >3</option>
							         <option value="4">4</option>
							         <option value="5">5</option>
							         <option value="6">6</option>
							         <option value="7">7</option>
							         <option value="8">8</option>
							         <option value="9">9</option>
							         <option value="10">10</option>
							         <option value="11">11</option>
							         <option value="12">12</option>
							         <option value="13">13</option>
							         <option value="14">14</option>
							         <option value="15">15</option>
							         <option value="16">16</option>
							         <option value="17">17</option>
							         <option value="18">18</option>
							         <option value="19">19</option>
							         <option value="20">20</option>
							         <option value="21">21</option>
							         <option value="22">22</option>
							         <option value="23">23</option>
							         <option value="24">24</option>
							         <option value="25">25</option>
							         <option value="26">26</option>
							         <option value="27">27</option>
							         <option value="28">28</option>
							         <option value="29">29</option>
							         <option value="30">30</option>
							         <option value="31">31</option>
							        </select>
							       日
							       </td><td align="left"></td>
							    </tr>
							  	</table>     
					        	</td>
					        	<td align="left"></td>
			       </tr>
			           
			       <tr>
				     <td align="right" class="l-table-edit-td s-lab">
				      <input id="accountsType_1" type="checkbox" name="accountsType" checked =true value="1"></td>
				      <td align="left" class="l-table-edit-td s-lab"> 
				                   购销结算
				        </td><td align="left"></td>
				      </tr>
				  
				      <tr>
				        <td align="right" class="l-table-edit-td s-lab"></td>
				        <td align="left" class="l-table-edit-td s-lab"> 
				       <table  id="sellByGou_tb"  cellpadding="0" cellspacing="0" class="l-table-edit p-tab" >
				      <tr>
				        <td align="right" class="l-table-edit-td s-lab">结算周期（每月）：</td>
				        <td align="left" class="l-table-edit-td s-lab"> 
				         <select id="accountsTime_1" name="accountsTime" width="30%">
				         <option value="">请选择</option>
				         <option value="1" <c:if test="${item.accountsTime=='1'}">selected</c:if>>1</option>
				         <option value="2" <c:if test="${item.accountsTime=='2'}">selected</c:if>>2</option>
				         <option value="3" <c:if test="${item.accountsTime=='3'}">selected</c:if>>3</option>
				         <option value="4" <c:if test="${item.accountsTime=='4'}">selected</c:if>>4</option>
				         <option value="5" <c:if test="${item.accountsTime=='5'}">selected</c:if>>5</option>
				         <option value="6" <c:if test="${item.accountsTime=='6'}">selected</c:if>>6</option>
				         <option value="7" <c:if test="${item.accountsTime=='7'}">selected</c:if>>7</option>
				         <option value="8" <c:if test="${item.accountsTime=='8'}">selected</c:if>>8</option>
				         <option value="9" <c:if test="${item.accountsTime=='9'}">selected</c:if>>9</option>
				         <option value="10" <c:if test="${item.accountsTime=='10'}">selected</c:if>>10</option>
				         <option value="11" <c:if test="${item.accountsTime=='11'}">selected</c:if>>11</option>
				         <option value="12" <c:if test="${item.accountsTime=='12'}">selected</c:if>>12</option>
				         <option value="13" <c:if test="${item.accountsTime=='13'}">selected</c:if>>13</option>
				         <option value="14" <c:if test="${item.accountsTime=='14'}">selected</c:if>>14</option>
				         <option value="15" <c:if test="${item.accountsTime=='15'}">selected</c:if>>15</option>
				         <option value="16" <c:if test="${item.accountsTime=='16'}">selected</c:if>>16</option>
				         <option value="17" <c:if test="${item.accountsTime=='17'}">selected</c:if>>17</option>
				         <option value="18" <c:if test="${item.accountsTime=='18'}">selected</c:if>>18</option>
				         <option value="19" <c:if test="${item.accountsTime=='19'}">selected</c:if>>19</option>
				         <option value="20" <c:if test="${item.accountsTime=='20'}">selected</c:if>>20</option>
				         <option value="21" <c:if test="${item.accountsTime=='21'}">selected</c:if>>21</option>
				         <option value="22" <c:if test="${item.accountsTime=='22'}">selected</c:if>>22</option>
				         <option value="23" <c:if test="${item.accountsTime=='23'}">selected</c:if>>23</option>
				         <option value="24" <c:if test="${item.accountsTime=='24'}">selected</c:if>>24</option>
				         <option value="25" <c:if test="${item.accountsTime=='25'}">selected</c:if>>25</option>
				         <option value="26" <c:if test="${item.accountsTime=='26'}">selected</c:if>>26</option>
				         <option value="27" <c:if test="${item.accountsTime=='27'}">selected</c:if>>27</option>
				         <option value="28" <c:if test="${item.accountsTime=='28'}">selected</c:if>>28</option>
				         <option value="29" <c:if test="${item.accountsTime=='29'}">selected</c:if>>29</option>
				         <option value="30" <c:if test="${item.accountsTime=='30'}">selected</c:if>>30</option>
				         <option value="31" <c:if test="${item.accountsTime=='31'}">selected</c:if>>31</option>
				        </select>
				            日
				       </td><td align="left"></td>
				    </tr>
				   </table>       
				 </td>
			   <td align="left"></td>
	         </tr>
	       </c:if>
         </c:forEach>
      </c:when>
      
      <c:when test="${accountSize == 2}">
      <c:forEach items="${supplierAccountsList}" var="item">
          <c:if test="${item.accountsType=='2'}">
				    <tr>
				        <td align="right" class="l-table-edit-td s-lab">
				        <input id="accountsType_2" type="checkbox" name="accountsType_2" checked=true value="2"></td>
				        <td align="left" class="l-table-edit-td s-lab"> 
				                                   代销结算
				         </td><td align="left"></td>
				       </tr>
					       <tr>
					        <td align="right" class="l-table-edit-td s-lab"></td>
					        <td align="left" class="l-table-edit-td s-lab"> 
							   <table cellpadding="0" cellspacing="0"  id="agency_tb"  class="l-table-edit p-tab" >
							     <c:if test="${item.accountsWay=='2'}">
							    <tr>
							        <td align="right" class="l-table-edit-td s-lab" >结算方式：</td>
							         <td align="left" class="l-table-edit-td s-lab">
							         <input name="accountsWay" type="radio"  id="accountsWay_1"  value="1"/>扣点
							         <input name="accountsWay" type="radio"  checked="checked"  id="accountsWay_2" value="2"/>底价
							         </td>
							        <td align="left"></td>
							    </tr>
							     <tr id="pointsScaleId" style="display: none;">
							        <td align="right" class="l-table-edit-td s-lab">扣点比例：</td>
							        <td align="left" class="l-table-edit-td "><input name="pointsScale" class="l-textarea"  maxlength="3"   type="text"  id="pointsScale"  />%</td>
							        <td align="left"></td>
							    </tr>
				       
				       </c:if>
				       
					   <c:if test="${item.accountsWay=='1'}">
						<tr>
				        <input name="accountsType" id="accountsType"  type="hidden" value="2">
				        <td align="right" class="l-table-edit-td s-lab" >结算方式:</td>
				         <td align="left" class="l-table-edit-td s-lab">
				         <input name="accountsWay" type="radio" checked="checked"  id="accountsWay_1"  value="1"/>扣点
				         <input name="accountsWay" type="radio" id="accountsWay_2" value="2"/>底价
				         </td>
				        <td align="left"></td>
				     </tr>
				     <tr id="pointsScaleId">
				        <td align="right" class="l-table-edit-td s-lab">扣点比例:</td>
				        <td align="left" class="l-table-edit-td "><input name="pointsScale" class="l-textarea" maxlength="3"  value="${item.pointsScale}"  type="text"  id="pointsScale" />%</td>
				        <td align="left"></td>
				    </tr>
				   </c:if>
							  
					 <tr>
							        <td align="right" class="l-table-edit-td s-lab">结算周期（每月）：</td>
							        <td align="left" class="l-table-edit-td s-lab"> 
							         <select id="accountsTime_2" name="accountsTime" width="30%" class="l-textarea" >
							         <option value="">请选择</option>
							         <option value="1" <c:if test="${item.accountsTime=='1'}">selected</c:if>>1</option>
							         <option value="2" <c:if test="${item.accountsTime=='2'}">selected</c:if>>2</option>
							         <option value="3" <c:if test="${item.accountsTime=='3'}">selected</c:if>>3</option>
							         <option value="4" <c:if test="${item.accountsTime=='4'}">selected</c:if>>4</option>
							         <option value="5" <c:if test="${item.accountsTime=='5'}">selected</c:if>>5</option>
							         <option value="6" <c:if test="${item.accountsTime=='6'}">selected</c:if>>6</option>
							         <option value="7" <c:if test="${item.accountsTime=='7'}">selected</c:if>>7</option>
							         <option value="8" <c:if test="${item.accountsTime=='8'}">selected</c:if>>8</option>
							         <option value="9" <c:if test="${item.accountsTime=='9'}">selected</c:if>>9</option>
							         <option value="10" <c:if test="${item.accountsTime=='10'}">selected</c:if>>10</option>
							         <option value="11" <c:if test="${item.accountsTime=='11'}">selected</c:if>>11</option>
							         <option value="12" <c:if test="${item.accountsTime=='12'}">selected</c:if>>12</option>
							         <option value="13" <c:if test="${item.accountsTime=='13'}">selected</c:if>>13</option>
							         <option value="14" <c:if test="${item.accountsTime=='14'}">selected</c:if>>14</option>
							         <option value="15" <c:if test="${item.accountsTime=='15'}">selected</c:if>>15</option>
							         <option value="16" <c:if test="${item.accountsTime=='16'}">selected</c:if>>16</option>
							         <option value="17" <c:if test="${item.accountsTime=='17'}">selected</c:if>>17</option>
							         <option value="18" <c:if test="${item.accountsTime=='18'}">selected</c:if>>18</option>
							         <option value="19" <c:if test="${item.accountsTime=='19'}">selected</c:if>>19</option>
							         <option value="20" <c:if test="${item.accountsTime=='20'}">selected</c:if>>20</option>
							         <option value="21" <c:if test="${item.accountsTime=='21'}">selected</c:if>>21</option>
							         <option value="22" <c:if test="${item.accountsTime=='22'}">selected</c:if>>22</option>
							         <option value="23" <c:if test="${item.accountsTime=='23'}">selected</c:if>>23</option>
							         <option value="24" <c:if test="${item.accountsTime=='24'}">selected</c:if>>24</option>
							         <option value="25" <c:if test="${item.accountsTime=='25'}">selected</c:if>>25</option>
							         <option value="26" <c:if test="${item.accountsTime=='26'}">selected</c:if>>26</option>
							         <option value="27" <c:if test="${item.accountsTime=='27'}">selected</c:if>>27</option>
							         <option value="28" <c:if test="${item.accountsTime=='28'}">selected</c:if>>28</option>
							         <option value="29" <c:if test="${item.accountsTime=='29'}">selected</c:if>>29</option>
							         <option value="30" <c:if test="${item.accountsTime=='30'}">selected</c:if>>30</option>
							         <option value="31" <c:if test="${item.accountsTime=='31'}">selected</c:if>>31</option>
							        </select>
							       日
							       </td><td align="left"></td>
							    </tr>
							  	</table>         
					   </td><td align="left"></td>
			    </tr>
			    </c:if >
			    
			    
               <c:if test="${item.accountsType=='1'}">
			       <tr>
				     <td align="right" class="l-table-edit-td s-lab">
				      <input id="accountsType_1" type="checkbox" name="accountsType" checked =true value="1"></td>
				      <td align="left" class="l-table-edit-td s-lab"> 
				                   购销结算
				        </td><td align="left"></td>
				      </tr>
				  
				      <tr>
				        <td align="right" class="l-table-edit-td s-lab"></td>
				        <td align="left" class="l-table-edit-td s-lab"> 
				       <table  id="sellByGou_tb"  cellpadding="0" cellspacing="0" class="l-table-edit p-tab" >
				      <tr>
				        <td align="right" class="l-table-edit-td s-lab">结算周期（每月）：</td>
				        <td align="left" class="l-table-edit-td s-lab"> 
				         <select id="accountsTime_1" name="accountsTime" width="30%">
				         <option value="">请选择</option>
				         <option value="1" <c:if test="${item.accountsTime=='1'}">selected</c:if>>1</option>
				         <option value="2" <c:if test="${item.accountsTime=='2'}">selected</c:if>>2</option>
				         <option value="3" <c:if test="${item.accountsTime=='3'}">selected</c:if>>3</option>
				         <option value="4" <c:if test="${item.accountsTime=='4'}">selected</c:if>>4</option>
				         <option value="5" <c:if test="${item.accountsTime=='5'}">selected</c:if>>5</option>
				         <option value="6" <c:if test="${item.accountsTime=='6'}">selected</c:if>>6</option>
				         <option value="7" <c:if test="${item.accountsTime=='7'}">selected</c:if>>7</option>
				         <option value="8" <c:if test="${item.accountsTime=='8'}">selected</c:if>>8</option>
				         <option value="9" <c:if test="${item.accountsTime=='9'}">selected</c:if>>9</option>
				         <option value="10" <c:if test="${item.accountsTime=='10'}">selected</c:if>>10</option>
				         <option value="11" <c:if test="${item.accountsTime=='11'}">selected</c:if>>11</option>
				         <option value="12" <c:if test="${item.accountsTime=='12'}">selected</c:if>>12</option>
				         <option value="13" <c:if test="${item.accountsTime=='13'}">selected</c:if>>13</option>
				         <option value="14" <c:if test="${item.accountsTime=='14'}">selected</c:if>>14</option>
				         <option value="15" <c:if test="${item.accountsTime=='15'}">selected</c:if>>15</option>
				         <option value="16" <c:if test="${item.accountsTime=='16'}">selected</c:if>>16</option>
				         <option value="17" <c:if test="${item.accountsTime=='17'}">selected</c:if>>17</option>
				         <option value="18" <c:if test="${item.accountsTime=='18'}">selected</c:if>>18</option>
				         <option value="19" <c:if test="${item.accountsTime=='19'}">selected</c:if>>19</option>
				         <option value="20" <c:if test="${item.accountsTime=='20'}">selected</c:if>>20</option>
				         <option value="21" <c:if test="${item.accountsTime=='21'}">selected</c:if>>21</option>
				         <option value="22" <c:if test="${item.accountsTime=='22'}">selected</c:if>>22</option>
				         <option value="23" <c:if test="${item.accountsTime=='23'}">selected</c:if>>23</option>
				         <option value="24" <c:if test="${item.accountsTime=='24'}">selected</c:if>>24</option>
				         <option value="25" <c:if test="${item.accountsTime=='25'}">selected</c:if>>25</option>
				         <option value="26" <c:if test="${item.accountsTime=='26'}">selected</c:if>>26</option>
				         <option value="27" <c:if test="${item.accountsTime=='27'}">selected</c:if>>27</option>
				         <option value="28" <c:if test="${item.accountsTime=='28'}">selected</c:if>>28</option>
				         <option value="29" <c:if test="${item.accountsTime=='29'}">selected</c:if>>29</option>
				         <option value="30" <c:if test="${item.accountsTime=='30'}">selected</c:if>>30</option>
				         <option value="31" <c:if test="${item.accountsTime=='31'}">selected</c:if>>31</option>
				        </select>
				            日
				       </td><td align="left"></td>
				    </tr>
				   </table>       
				 </td>
			   <td align="left"></td>
	         </tr>
	       </c:if>
	     </c:forEach>
      </c:when>
    </c:choose>
</table>

<input type="hidden" name="aslist" id="aslist" />
<input type="submit" value="保存" id="Button1" class="l-button l-button-submit" /> 
<input type="button" value="取消" name="tests"  id="tests" class="l-button l-button-test" />
</form>
<div style="display:none">
<!--  数据统计代码 --></div>

<script type="text/javascript">	
	
$(function ()
		{
	
	   $("#Button1").click(function(){
           var accountType1 = document.getElementById("accountsType_1").checked;
           var accountType2 = document.getElementById("accountsType_2").checked;
          if(accountType1 == false && accountType2== false){
        	  $.ligerDialog.warn('请选择结算类型');
       	   return false;
          }
       });
	   
       $("#Button1").click(function(){
           var accountType1 = document.getElementById("accountsType_1").checked;
           var accountType2 = document.getElementById("accountsType_2").checked;
           var accountTime1 = $("#accountsTime_1").val();
           if(accountType2)
           {
           	var accountTime = $("#accountsTime_2").val();
           	var aw = "";
           	$("input[name=accountsWay]").each(function(){
	        if(this.checked){
	        			aw = this.value;
	        		}
	        	});
           	if(aw=="1")
           	{
           		var ps = $("#pointsScale").val();
           		
           		if(ps == '')
           		{
           			$.ligerDialog.warn('请输入扣点比例');
           			return false;
           		}
           		if(!ps.match(/^(?:\d?\d|100)$/gi))
           		{
           			$.ligerDialog.warn('只允许输入1-100正整数');
           			return false;
           		}
           		if(accountTime=='')
           		{
           			$.ligerDialog.warn('请选择结算周期');
           			return false;
           		}
           		
           	}else
           	{
           		if(accountTime=='')
           		{
           			$.ligerDialog.warn('请选择结算周期');
           			return false;
           		}	
           	}
           }
           
           
           if(accountType1)
           {
           	if(accountTime1 =='')
           	{
           		$.ligerDialog.warn('请选择结算周期');
       			return false;
           	}
           }
       });
	   
			//validate
		    $.metadata.setType("attr", "validate");
		    var v = $("form").validate({
		        errorPlacement: function (lable, element)
		        {
		        	lable.ligerHideTip();
		            if (element.hasClass("l-textarea"))
		            {
		                element.ligerTip({ content: lable.html(), target: element[0] }); 
		            }
		            else if (element.hasClass("l-text-field"))
		            {
		                element.parent().ligerTip({ content: lable.html(), target: element[0] });
		            }
		            else
		            {
		                lable.appendTo(element.parents("td:first").next("td"));
		            }
		        }
		    ,
		        success: function (lable)
		        {
		            lable.ligerHideTip();
		            lable.remove();
		        },
		        submitHandler:function()
		        {		        	
	                var as =new Array();
		        	
		            $("form .l-text,.l-textarea").ligerHideTip();
		            if(document.getElementById("accountsType_2").checked){
		            	var accountsWay = "";
		            	$("input[name=accountsWay]").each(function(){
			        		if(this.checked){
			        			accountsWay = this.value;
			        		}
			        	});
		            	as.push({"accountsType":$("#accountsType_2").val(),"accountsWay":accountsWay,"pointsScale":$("#pointsScale").val(),"accountsTime":$("select[name=accountsTime]").eq(0).val()});
		            }
		            if(document.getElementById("accountsType_1").checked){
		            	as.push({"accountsType":$("#accountsType_1").val(),"accountsTime":$("select[name=accountsTime]").eq(1).val()});
		            }
		            $("#aslist").val(JSON.stringify(as));
		            
		            $("form .l-text,.l-textarea").ligerHideTip();
		            var options = {
		            		type: 'POST',
		            		beforeSend: function(){
		            			$("#form1").find(":submit,:button").attr("disabled", true);
		            		},
		            		success: function(data){
		            			if(data=="success") {
		            				window.parent.f_tip('修改成功');
		           					close_liger_tab();
		            			}else if(data=="wms_fail"){
		            				window.parent.f_tip('WMS系统推送数据失败');
		            		   }else {
		            				window.parent.f_tip('修改失败');
		            			}
		            		}
		            	}, $form1 = $("#form1");
		           $form1.ajaxSubmit(options);
		             return false;
		        }
		    });
		});  
//取消
$("#tests").click(function() {
	close_liger_tab();
});

$("input[name='accountsWay']").click(function(){
	var wayVal = $(this).val();
	if(wayVal == 2){
		$("#pointsScaleId").hide();
		$("#pointsScale").text('');
	}else {
		$("#pointsScaleId").show();
	}
})

$('#accountsType_2').click(function(){
	if(this.checked){
		$("#agency_tb").show();
	}else{
		$("#agency_tb").hide();
		//清空
		$("#pointsScale").text('');
		$("#accountsTime_2").val("");
	}
})

$('#accountsType_1').click(function(){
	if(this.checked){
		$("#sellByGou_tb").show();
	}else{
		$('#sellByGou_tb').hide();
		$("#accountsTime_1").val("");
	}
})
</script>
</body>
</html>